package com.yunfangdata.service.impl;

import com.yunfangdata.domain.Attendance;
import com.yunfangdata.mapper.AttendanceMapper;
import com.yunfangdata.query.QueryObject;
import com.yunfangdata.service.IAttendanceService;
import com.yunfangdata.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AttendanceServiceImpl implements IAttendanceService {


    @Autowired
    private AttendanceMapper mapper;

    public void save(Attendance entity) {
        entity.getInTime();




        mapper.insert(entity);
    }


    public Attendance get(Long id) {
        return mapper.selectByPrimaryKey(id);
    }



    public PageResult query(QueryObject qo) {
        int total = mapper.queryForCount(qo);

        if (total == 0){
            return new PageResult();
        }
        List<Attendance> rows = mapper.queryForList(qo);

        return new PageResult(total,rows);
    }

}
